<?php
$api = app('Dingo\Api\Routing\Router');

$api->version('v1', [
  'namespace' => 'Zxf5115\Laravel\Advertising\Controllers\Platform'
], function ($api)
{
  $api->group([
    'middleware' => 'api.throttle', // 启用节流限制
    'limit' => 1000, // 允许次数
    'expires' => 1, // 分钟
    'prefix' => 'platform' // 接口前缀
  ], function ($api)
  {
    // --------------------------------------------------
    // 核心路由
    $api->group(['middleware' => ['white.list', 'black.list', 'auth:platform', 'refresh.token.platform']], function ($api) {
      // 广告路由
      $api->group(['prefix' => 'advertising'], function ($api) {
        $api->any('list', 'AdvertisingController@list');
        $api->get('view/{id}', 'AdvertisingController@view');
        $api->post('handle', 'AdvertisingController@handle');
        $api->post('status', 'AdvertisingController@status');
        $api->post('delete', 'AdvertisingController@delete');

        // 广告路由组
        $api->group(['namespace' => 'Advertising'], function ($api) {
          // 广告详情路由
          $api->group(['prefix' => 'detail'], function ($api) {
            $api->get('data', 'DetailController@data');
          });

          // 广告位路由
          $api->group(['prefix' => 'position'], function ($api) {
            $api->any('list', 'PositionController@list');
            $api->get('select', 'PositionController@select');
            $api->get('view/{id}', 'PositionController@view');
            $api->post('handle', 'PositionController@handle');
            $api->post('status', 'PositionController@status');
            $api->post('delete', 'PositionController@delete');
          });
        });
      });
    });
  });
});
